package com.xjscrm.server.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjscrm.common.entity.Material;
import com.xjscrm.server.dto.material.MaterialQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface MaterialMapper {

    int deleteById(@Param("id") Long id);

    int deleteByEarliest(@Param("merId") Long merId, @Param("childId") Long childId, @Param("type") Integer type, @Param("important") Integer important, @Param("deleteCount") Integer deleteCount);

    int insert(Material record);

    int insertSelective(Material record);

    Material selectById(@Param("id") Long id);

    int updateByIdSelective(Material record);

    int updateById(Material record);

    /**
     * 分页查询
     *
     * @param page
     * @param query
     * @return
     */
    ArrayList<Material> findByList(Page<Material> page, @Param("query") MaterialQuery query);

    /**
     * 分页查询
     *
     * @param query
     * @param query
     * @return
     */
    Integer findCount(@Param("query") MaterialQuery query);


}